import underscore from 'underscore'

export function dataQuery(list, query) {
  // // 去除空项的筛选条件
  // for (const key in query) {
  //   if (query.hasOwnProperty(key)) {
  //     const element = query[key]
  //     if (element === '') underscore.omit(query, key)
  //   }
  // }
  // console.log('query', query)
  // // 筛选条件
  // for (const key in query) {
  //   if (query.hasOwnProperty(key)) {
  //     const element = query[key]
  //     list = list.filter(a => a[key])
  //   }
  // }
}
// 生成随机数字类型数组
export function randomNumArr(limit, length) {
  const numArr = []
  for (let i = 0; i < length; i++) {
    const element = Math.ceil(Math.random() * limit)
    numArr.push(element)
  }
  return numArr;
}
// 判断数字是否最小值 
export function isMin(numList, num) {
  for (const i of numList) {
    if (i <= num) return false
  }
  return true
}
// 格式化导出数据
export function formatList(list, keys) {
  const newList = []
  for (const i of list) {
    const item = {}
    for (const j of keys) {
      item[j] = i[j]
    }
    newList.push(item)
  }
  return newList
}